﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Toolkit.Web.ViewComponents.DataGrid
{
    public sealed class DataGridCell<T> where T : class
    {
        public DataGridCell(DataGridColumn<T> column, T dataItem, int rowIndex)
        {
            if (column == null)
            {
                throw new ArgumentNullException("column");
            }

            if (rowIndex < 0)
            {
                throw new ArgumentOutOfRangeException("rowIndex");
            }

            HtmlAttributes = new Dictionary<string, object>(StringComparer.OrdinalIgnoreCase);
            DataGrid = column.DataGrid;
            Column = column;
            DataItem = dataItem;
            RowIndex = rowIndex;
        }

        public DataGrid<T> DataGrid
        {
            get;
            private set;
        }

        public DataGridColumn<T> Column
        {
            get;
            private set;
        }

        public T DataItem
        {
            get;
            private set;
        }

        public IDictionary<string, object> HtmlAttributes
        {
            get;
            private set;
        }

        public int RowIndex
        {
            get;
            private set;
        }
    }
}
